from ronglian_sms_sdk import SmsSDK

import oss2,uuid

# 阿里云oss存储    --   测试文件上传  --  图片

OSS_AccessKey_ID = 'LTAI5tDgKK1chzxSfXiQBUor'
OSS_AccessKey_Secret = 'aao2LvJhCxsL25igG7bhzQhaFN40lP'
OSS_ENDPOINT = "oss-cn-beijing.aliyuncs.com"   #访问域名
OSS_BUCKET_NAME = "wangzheng1" #存储空间名称

# 创建存储空间的操作实例对象
# 认证
auth = oss2.Auth(OSS_AccessKey_ID,OSS_AccessKey_Secret)

bucket = oss2.Bucket(auth,OSS_ENDPOINT,OSS_BUCKET_NAME)
# http://128.0.0.1:9000/uploads/2024/2/s238dflansdf.png
image_name = f'test/{str(uuid.uuid4())}.jpg'

# 查找一个文件（图片）
with open('D:\\p0\\SC\\1.jpg','rb') as f:
    # 上传文件对象  --- 阿里云oss上传
    # 文件名，文件对象：流
    result = bucket.put_object(image_name,f.read())
    print('----------上传结果------------')
    print(result)


# accId = "2c94811c8853194e0188b881d3f222c6"
# accToken = "c4a8a97a15c24a63891441727277849d"
# appId = "2c94811c9035ff9f01923226d32e66e0"
#
#
# def send_message():
#     sdk = SmsSDK(accId, accToken, appId)
#     tid = "1"
#     mobiles = "17788209492"
#     datas = ["1234", "2"]
#     resp = sdk.sendMessage(tid, mobiles, datas)
#     print(resp)
#
# send_message()

